package com.nbicc.dp.web.wspanel.controller;

import com.nbicc.dp.web.wspanel.dtoservice.WsPanelDtoService;
import com.nbicc.dp.wsgateway.common.WsPush;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

/**
 * @Author: lilingyan
 */
@Api(value = "dp:在线看板控制" , description = "")
@RestController
@RequestMapping("/ws/panel")
public class WsPanelController {

    @Autowired
    private WsPanelDtoService wsPanelDtoService;

    @ApiOperation(value = "获取所有在线面板的序列号和内部的控件号")
    @GetMapping("/onlinePanel")
    public ResponseEntity<ModelMap> listAllOnlinePanel(){
        return wsPanelDtoService.listAllOnlinePanel();
    }

    @ApiIgnore
    @ApiOperation(value = "向控件发消息")
    @PostMapping("/wsPush")
    public ResponseEntity<ModelMap> pushMsgToPanel(
            @RequestBody WsPush wsPush){
        return wsPanelDtoService.pushMsgToPanel(wsPush);
    }

}
